<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="node_modules/echarts/dist/echarts.js"></script>
    <script src="node_modules/echarts-wordcloud/dist/echarts-wordcloud.min.js"></script>
    <style>
        #main{width:500px;height:200px;border:solid 1px #F00;}
    </style>

</head>
<body>

<div id="main"></div>    <script>
    var chart = echarts.init(document.getElementById('main'));
    var colorArr=['#246892','#2c84c7','#009be3','#07b9fe','#24cdff','#4adeff','#6ff6f5'];
    chart.setOption({
        tooltip: {
            show:true,
            formatter: '{b} : {c}'
        },
        series: [{
            type: 'wordCloud',
            shape: 'circle',
            left: 'center',
            top: 'center',
            width: '100%',
            height: '80%',
            right: 'center',
            bottom: 'center',
            sizeRange: [12, 60],
            rotationRange: [0,0],
            rotationStep: 45,
            gridSize: 20,
            textStyle: {
                normal: {
                    fontFamily: 'sans-serif',
                    fontWeight: 'bold',
                    color: function (para) {
                        console.log(para.dataIndex);
                        return colorArr[para.dataIndex%7];
                    }
                },
                emphasis: {
                    opacity: .8
                }
            },

            // Data is an array. Each array item must have name and value property.
            data: [
                 {"name":"河北","value":600},
                {"name":"有限公司","value":550},
                {"name":"规模","value":500},
                {"name":"农业银行","value":450},
                {"name":"邢台","value":400},
                {"name":"科技","value":350},
                {"name":"投资","value":300},
                {"name":"邯郸","value":250},
                {"name":"沧州","value":280},
                {"name":"现代农业","value":260},
                {"name":"中国工商银行","value":240},
                {"name":"工作","value":220},
                {"name":"农村","value":200},
                {"name":"北京","value":180},
                {"name":"土地","value":160},
                {"name":"生活","value":130},
                {"name":"股份","value":128},
                {"name":"项目","value":126},
                {"name":"国家","value":124},
                {"name":"集团","value":100},
                {"name":"公司","value":80},
                {"name":"新闻","value":60},
                {"name":"邢台市","value":40},
                {"name":"农业部","value":30},
                {"name":"日报","value":12} 

                // 好看
               /*{"name":"河北","value":60},
                {"name":"有限公司","value":40},
                {"name":"规模","value":30},
                {"name":"农业银行","value":30},
                {"name":"邢台","value":30},
                {"name":"科技","value":30},
                {"name":"投资","value":32},
                {"name":"邯郸","value":34},
                {"name":"沧州","value":32},
                {"name":"现代农业","value":28},
                {"name":"中国工商银行","value":30},
                {"name":"工作","value":48},
                {"name":"农村","value":24},
                {"name":"北京","value":24},
                {"name":"土地","value":22},
                {"name":"生活","value":26},
                {"name":"股份","value":24},
                {"name":"项目","value":22},
                {"name":"国家","value":20},
                {"name":"集团","value":18},
                {"name":"公司","value":18},
                {"name":"新闻","value":20},
                {"name":"邢台市","value":20},
                {"name":"农业部","value":20},
                {"name":"日报","value":18} */

                 /*  {"name":"河北","value":18},
                {"name":"有限公司","value":17},
                {"name":"规模","value":16},
                {"name":"农业银行","value":15},
                {"name":"邢台","value":14},
                {"name":"科技","value":13},
                {"name":"投资","value":12},
                {"name":"邯郸","value":11},
                {"name":"沧州","value":10},
                {"name":"现代农业","value":9},
                {"name":"中国工商银行","value":8},
                {"name":"工作","value":7},
                {"name":"农村","value":6},
                {"name":"北京","value":5},
                {"name":"土地","value":18},
                {"name":"生活","value":17},
                {"name":"股份","value":16},
                {"name":"项目","value":15},
                {"name":"国家","value":14},
                {"name":"集团","value":13},
                {"name":"公司","value":12},
                {"name":"新闻","value":11},
                {"name":"邢台市","value":10},
                {"name":"农业部","value":9},
                {"name":"日报","value":8}, {"name":"河北","value":18},
                {"name":"有限公司","value":17},
                {"name":"规模","value":16},
                {"name":"农业银行","value":15},
                {"name":"邢台","value":14},
                {"name":"科技","value":13},
                {"name":"投资","value":12},
                {"name":"邯郸","value":11},
                {"name":"沧州","value":10},
                {"name":"现代农业","value":9},
                {"name":"中国工商银行","value":8},
                {"name":"工作","value":7},
                {"name":"农村","value":6},
                {"name":"北京","value":5},
                {"name":"土地","value":18},
                {"name":"生活","value":17},
                {"name":"股份","value":16},
                {"name":"项目","value":15},
                {"name":"国家","value":14},
                {"name":"集团","value":13},
                {"name":"公司","value":12},
                {"name":"新闻","value":11},
                {"name":"邢台市","value":10},
                {"name":"农业部","value":9},
                {"name":"日报","value":8}, {"name":"河北","value":18},
                {"name":"有限公司","value":17},
                {"name":"规模","value":16},
                {"name":"农业银行","value":15},
                {"name":"邢台","value":14},
                {"name":"科技","value":13},
                {"name":"投资","value":12},
                {"name":"邯郸","value":11},
                {"name":"沧州","value":10},
                {"name":"现代农业","value":9},
                {"name":"中国工商银行","value":8},
                {"name":"工作","value":7},
                {"name":"农村","value":6},
                {"name":"北京","value":5},
                {"name":"土地","value":18},
                {"name":"生活","value":17},
                {"name":"股份","value":16},
                {"name":"项目","value":15},
                {"name":"国家","value":14},
                {"name":"集团","value":13},
                {"name":"公司","value":12},
                {"name":"新闻","value":11},
                {"name":"邢台市","value":10},
                {"name":"农业部","value":9},
                {"name":"日报","value":8}, {"name":"河北","value":18},
                {"name":"有限公司","value":17},
                {"name":"规模","value":16},
                {"name":"农业银行","value":15},
                {"name":"邢台","value":14},
                {"name":"科技","value":13},
                {"name":"投资","value":12},
                {"name":"邯郸","value":11},
                {"name":"沧州","value":10},
                {"name":"现代农业","value":9},
                {"name":"中国工商银行","value":8},
                {"name":"工作","value":7},
                {"name":"农村","value":6},
                {"name":"北京","value":5},
                {"name":"土地","value":18},
                {"name":"生活","value":17},
                {"name":"股份","value":16},
                {"name":"项目","value":15},
                {"name":"国家","value":14},
                {"name":"集团","value":13},
                {"name":"公司","value":12},
                {"name":"新闻","value":11},
                {"name":"邢台市","value":10},
                {"name":"农业部","value":9},
                {"name":"日报","value":8}, {"name":"河北","value":18},
                {"name":"有限公司","value":17},
                {"name":"规模","value":16},
                {"name":"农业银行","value":15},
                {"name":"邢台","value":14},
                {"name":"科技","value":13},
                {"name":"投资","value":12},
                {"name":"邯郸","value":11},
                {"name":"沧州","value":10},
                {"name":"现代农业","value":9},
                {"name":"中国工商银行","value":8},
                {"name":"工作","value":7},
                {"name":"农村","value":6},
                {"name":"北京","value":5},
                {"name":"土地","value":18},
                {"name":"生活","value":17},
                {"name":"股份","value":16},
                {"name":"项目","value":15},
                {"name":"国家","value":14},
                {"name":"集团","value":13},
                {"name":"公司","value":12},
                {"name":"新闻","value":11},
                {"name":"邢台市","value":10},
                {"name":"农业部","value":9},
                {"name":"日报","value":8}*/
            ]
        }]
    });
</script>
</body>
</html>